package com.yazi.mxz.gather.main.store;

import java.util.List;

import com.myframework.smhj.common.tool.DateUtil;
import com.yazi.mxz.gather.common.App;
import com.yazi.mxz.gather.entity.beans.Store;
import com.yazi.mxz.gather.service.StoreService;

/**
 * 更新店铺
 * @author mo_yq5
 * @date 2015-8-17
 */
public class StoreUpdate extends Thread {
	
	private StoreService storeService;
	
	
	public StoreUpdate() {
		storeService = App.context.getBean(StoreService.class);
	}

	@Override
	public void run() {
		Store store  = new Store();
		store.setCompanyId(1l);
		List<Store> list = storeService.list(store);
		for (Store storeOrc : list) {
			storeOrc.setLat((Math.random()*(2280-2277) + 2279)/100);
			storeOrc.setLng((Math.random()*(10837-10836) + 10836)/100);
			storeOrc.setRecommandSort(new Double(Math.random() * 999999).longValue());
			storeOrc.setUpdateTime(DateUtil.getTimeStamp());
			storeService.merge(storeOrc);
			System.out.println("成功更新: " + storeOrc.getName());
		}
	}
	
}
